<?php
/**
 * PHP Framework Integration HTTP-to-SOAP Gateway Web Service class
 * This service makes SOAP services available to callers through the usual
 * HTTP REST interface
 **/

/**
 * Description of HTTPSOAPGatewayWebService
 *
 * @author Andrew <andrew@vitche.com>
 * @author Frozen Rain <frozenrain@mail.ru>
 **/
class HTTPSOAPGatewayWebService extends HTTPWebService {

    function __construct() {
        parent::__construct('');
    }

    function onMethodCall($strClassName, $strMethodName, $arRequest) {

        // Parse request
        $url = null;
        $arguments = array();
        foreach ($arRequest as $key => $value) {
            if ('url' == $key) {
                $url = $value;
            } else {
                $arguments[$key] = $value;
            }
        }

        $reference = new SOAPWebServiceReference($url);
        return JSONSerializer::toString($reference->execute($strMethodName, $arguments));
    }
}
?>